Working with Variants
This documentation includes client implementation of variants.
Summary
Variant isn't a mandatory feature and each product doesn't have a variation.
- You can visit Summary of Variants documentation for better understanding about variants._
Firsly you don't need to do something special while listing products. Let's make a sample for displaying variations:
1-List Products
List products as usual from /v2/products endpoint. There is no variant data here. (at least, no data for client)_
2-Get Detail a Product
Go detail a product and get product detail data as usual from /v2/products/:productId. Still there is nothing about variants.
3-Get Variants of a Product
The magic happened at this step ✨!
Get variations of that product from /v2/products/:procuctId/variations endpoint.
All variations looks like a product. You can use variantData property in each object to specify which variation.
Variation Options of Product
You can find which variation options product has. Use /v2/products/:productId/variation-groups endpoint for this action.
REMEMBER: The product may doesn't have variation for all options